From b054483b794975e6d98895b101e837516f95ffcf Mon Sep 17 00:00:00 2001 From: torkleyy Date: Fri, 12 May 2017 15:05:28 +0200 Subject: [PATCH] Add exclude flag to bench, check and test --- src/bin/bench.rs | 10 +++++----- src/bin/check.rs | 10 +++++----- src/bin/test.rs | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/bin/bench.rs b/src/bin/bench.rs index 6fa70f2b9..ba5a716dd 100644 --- a/src/bin/bench.rs +++ b/src/bin/bench.rs @@ -30,6 +30,7 @@ pub struct Options { flag_locked: bool, arg_args: Vec, flag_all: bool, + flag_exclude: Vec, } pub const USAGE: &'static str = " @@ -52,6 +53,7 @@ Options: --no-run Compile, but don't run benchmarks -p SPEC, --package SPEC ... Package to run benchmarks for --all Benchmark all packages in the workspace + --exclude SPEC ... Exclude packages from the benchmark -j N, --jobs N Number of parallel jobs, defaults to # of CPUs --features FEATURES Space-separated list of features to also build --all-features Build all available features @@ -86,11 +88,9 @@ Compilation can be customized with the `bench` profile in the manifest. pub fn execute(options: Options, config: &Config) -> CliResult { let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?; - let spec = if options.flag_all { - Packages::All - } else { - Packages::Packages(&options.flag_package) - }; + let spec = Packages::from_flags(options.flag_all, + &options.flag_exclude, + &options.flag_package)?; config.configure(options.flag_verbose, options.flag_quiet, diff --git a/src/bin/check.rs b/src/bin/check.rs index 20e7b3bfc..147ff43b9 100644 --- a/src/bin/check.rs +++ b/src/bin/check.rs @@ -15,6 +15,7 @@ Options: -h, --help Print this message -p SPEC, --package SPEC ... Package(s) to check --all Check all packages in the workspace + --exclude SPEC ... Exclude packages from the check -j N, --jobs N Number of parallel jobs, defaults to # of CPUs --lib Check only this package's library --bin NAME Check only the specified binary @@ -74,6 +75,7 @@ pub struct Options { flag_locked: bool, flag_frozen: bool, flag_all: bool, + flag_exclude: Vec, } pub fn execute(options: Options, config: &Config) -> CliResult { @@ -89,11 +91,9 @@ pub fn execute(options: Options, config: &Config) -> CliResult { let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?; let ws = Workspace::new(&root, config)?; - let spec = if options.flag_all { - Packages::All - } else { - Packages::Packages(&options.flag_package) - }; + let spec = Packages::from_flags(options.flag_all, + &options.flag_exclude, + &options.flag_package)?; let opts = CompileOptions { config: config, diff --git a/src/bin/test.rs b/src/bin/test.rs index 817c2bcc3..7829cb366 100644 --- a/src/bin/test.rs +++ b/src/bin/test.rs @@ -33,6 +33,7 @@ pub struct Options { flag_frozen: bool, flag_locked: bool, flag_all: bool, + flag_exclude: Vec, } pub const USAGE: &'static str = " @@ -56,6 +57,7 @@ Options: --no-run Compile, but don't run tests -p SPEC, --package SPEC ... Package to run tests for --all Test all packages in the workspace + --exclude SPEC ... Exclude packages from the test -j N, --jobs N Number of parallel builds, see below for details --release Build artifacts in release mode, with optimizations --features FEATURES Space-separated list of features to also build @@ -130,11 +132,9 @@ pub fn execute(options: Options, config: &Config) -> CliResult { &options.flag_bench, options.flag_benches); } - let spec = if options.flag_all { - Packages::All - } else { - Packages::Packages(&options.flag_package) - }; + let spec = Packages::from_flags(options.flag_all, + &options.flag_exclude, + &options.flag_package)?; let ops = ops::TestOptions { no_run: options.flag_no_run, -- 2.30.2